//
//  UIButton+Extension.m
//  JWBrowser
//
//  Created by Dejun Liu on 14-11-5.
//  Copyright (c) 2014年 JW. All rights reserved.
//

#import "UIButton+Extension.h"
#import "UIImage+Extension.h"

@implementation UIButton (Extension)

- (UIImage *)buttonImageFromColor:(UIColor *)color
{
    return [UIImage imageFromColor:color size:CGSizeMake(self.frame.size.width, self.frame.size.height)];
}

- (UIButton* )CreatedBarItem:(topBaritemType)type
{
    UIButton* btn = [UIButton buttonWithType:UIButtonTypeCustom];
    
    return btn;
}

+ (void)customButton:(UIButton *)btn title:(NSString *)title titleColor:(UIColor *)color font:(UIFont *)font bgImage:(UIImage *)bgImage highlightedImage:(UIImage *)highlightedImage
{
    [btn setTitle:title forState:UIControlStateNormal];
    [btn.titleLabel setFont:font];
    [btn setTitleColor:color forState:UIControlStateNormal];
    [btn setBackgroundImage:bgImage forState:UIControlStateNormal];
    [btn setBackgroundImage:highlightedImage forState:UIControlStateHighlighted];
}

@end
